<?php
namespace Plugin\Attractions\Commerce\Schema\Commerce_order;

use Plugin\Attractions\Commerce\Model\Commerce_order\CommerceOrder;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 订单
 */
#[Schema(title: 'CommerceOrderSchema')]
class CommerceOrderSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '订单号', type: 'bigint')]
    public string $id;

    #[Property(property: 'merchant_id', title: '商户ID', type: 'bigint')]
    public string $merchant_id;

    #[Property(property: 'customer_id', title: '客户ID', type: 'bigint')]
    public string $customer_id;

    #[Property(property: 'customer_name', title: '客户姓名', type: 'varchar')]
    public string $customer_name;

    #[Property(property: 'customer_phone', title: '客户电话', type: 'varchar')]
    public string $customer_phone;

    #[Property(property: 'customer_address', title: '客户地址', type: 'varchar')]
    public string $customer_address;

    #[Property(property: 'order_source', title: '订单来源：1-线上下单，2-现场订单', type: 'tinyint')]
    public string $order_source;

    #[Property(property: 'total_amount', title: '订单总金额', type: 'decimal')]
    public string $total_amount;

    #[Property(property: 'discount_amount', title: '优惠', type: 'decimal')]
    public string $discount_amount;

    #[Property(property: 'minus_amount', title: '满减优惠金额', type: 'decimal')]
    public string $minus_amount;

    #[Property(property: 'actual_amount', title: '实付金额', type: 'decimal')]
    public string $actual_amount;

    #[Property(property: 'payment_method', title: '付款方式1-银行转账,2-微信支付,3-支付宝支付,4-现金,5-其他付款方式', type: 'tinyint')]
    public string $payment_method;

    #[Property(property: 'payment_time', title: '支付时间', type: 'timestamp')]
    public string $payment_time;

    #[Property(property: 'delivery_time', title: '发货时间', type: 'timestamp')]
    public string $delivery_time;

    #[Property(property: 'express_company', title: '快递公司', type: 'varchar')]
    public string $express_company;

    #[Property(property: 'express_id', title: '快递单号', type: 'varchar')]
    public string $express_id;

    #[Property(property: 'express_cost', title: '快递费用', type: 'decimal')]
    public string $express_cost;

    #[Property(property: 'express_info', title: '快递信息', type: 'array')]
    public array $express_info;

    #[Property(property: 'order_status', title: '订单状态：1-未支付，2-已支付，3-已发货，4-已到货，5-已完成，6-已取消', type: 'tinyint')]
    public string $order_status;

    #[Property(property: 'cancel_reason', title: '取消原因', type: 'varchar')]
    public string $cancel_reason;

    #[Property(property: 'cancel_time', title: '取消时间', type: 'timestamp')]
    public string $cancel_time;

    #[Property(property: 'finish_time', title: '完成时间', type: 'timestamp')]
    public string $finish_time;

    #[Property(property: 'remark', title: '备注', type: 'text')]
    public string $remark;

    #[Property(property: 'created_at', title: 'created_at', type: 'datetime')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'datetime')]
    public string $updated_at;

    #[Property(property: 'deleted_at', title: 'deleted_at', type: 'timestamp')]
    public string $deleted_at;




    public function __construct(CommerceOrder $model)
    {
       $this->id = $model->id;
       $this->merchant_id = $model->merchant_id;
       $this->customer_id = $model->customer_id;
       $this->customer_name = $model->customer_name;
       $this->customer_phone = $model->customer_phone;
       $this->customer_address = $model->customer_address;
       $this->order_source = $model->order_source;
       $this->total_amount = $model->total_amount;
       $this->discount_amount = $model->discount_amount;
       $this->minus_amount = $model->minus_amount;
       $this->actual_amount = $model->actual_amount;
       $this->payment_method = $model->payment_method;
       $this->payment_time = $model->payment_time;
       $this->delivery_time = $model->delivery_time;
       $this->express_company = $model->express_company;
       $this->express_id = $model->express_id;
       $this->express_cost = $model->express_cost;
       $this->express_info = $model->express_info;
       $this->order_status = $model->order_status;
       $this->cancel_reason = $model->cancel_reason;
       $this->cancel_time = $model->cancel_time;
       $this->finish_time = $model->finish_time;
       $this->remark = $model->remark;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
       $this->deleted_at = $model->deleted_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'customer_id' => $this->customer_id ,'merchant_id' => $this->merchant_id ,'customer_name' => $this->customer_name ,'customer_phone' => $this->customer_phone ,'customer_address' => $this->customer_address ,'order_source' => $this->order_source ,'total_amount' => $this->total_amount ,'discount_amount' => $this->discount_amount ,'minus_amount' => $this->minus_amount ,'actual_amount' => $this->actual_amount ,'payment_method' => $this->payment_method ,'payment_time' => $this->payment_time ,'delivery_time' => $this->delivery_time ,'express_company' => $this->express_company ,'express_id' => $this->express_id ,'express_cost' => $this->express_cost ,'express_info' => $this->express_info ,'order_status' => $this->order_status ,'cancel_reason' => $this->cancel_reason ,'cancel_time' => $this->cancel_time ,'finish_time' => $this->finish_time ,'remark' => $this->remark ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at ,'deleted_at' => $this->deleted_at];
    }
}